	use "$dir\DataSCLB", clear
	global moderators_All L_BLabil Dmiss_BL Dmale Lage DTeachMale LTeachAge LTeachExper LTeachEduc Lenrol LPTR LPLEPassRate LNTeachers L_no_of_desks L_nursery L_repeat L_miss_school L_teach_miss L_home_fees L_Sanitation L_Information L_Home_conditions L_Caning D_c_compound D_vc_compound D_staff_room D_Access_to_books 
	
	pca $moderators_All	
	gen var = "" 
	local i = 1
	foreach var of global moderators_All {
		local varlabel: variable label `var'
		replace var = "`varlabel'" in `i'
		local i = `i'+1
	}
	// Format EigenValues
	mat eigenvalue  = e(Ev)'
	svmat eigenvalue 
	gen eigenvalue2 = eigenvalue/26
	gen eigenvalue3 = sum(eigenvalue2)
	count
	local obs = r(N)
	replace eigenvalue3 = . in 27/`obs'
	mkmat eigenvalue*, nomiss mat(eigenvalue)
	
	replace var = "Eigenvalue" in `i'
	local i = `i'+1
	replace var = "Prop. of Var. Explained" in `i'
	local i = `i'+1
	replace var = "Cum. Prop. Explained" in `i'
	mat eigenvector = e(L)
	mat eigenvalue  = eigenvalue'
	mat comp = eigenvector\eigenvalue
	svmat comp 
	forvalues i = 1/26 {
		tostring comp`i', format(%12.2f) replace force
	}
	gen sort = _n in 1/29
	replace sort = sort+3
	replace sort = 1 if var=="Eigenvalue"
	replace sort = 2 if var=="Prop. of Var. Explained"
	replace sort = 3 if var=="Cum. Prop. Explained"
	sort sort
	replace var = subinstr(var,"\","",.)			
	keep var comp1-comp10 
	keep in 1/29

	
	save "$output/AppendixTable3.dta", replace